Python For Finance Question

by: alshepro, 6 years ago


In the function:

def buy_sell_hold(*args):
    cols = [c for c in args]
    requirement = 0.02
    for col in cols:
        if col > requirement:
            return 1
        if col < -requirement:
            return -1
    return 0

It seems that you are comparing an entire dataframe column to the requirement, a singular scalar number, and then returning. How does this work? What am I missing here?



You must be logged in to post. Please login or register an account.